<?php
class godhouse {
	
	private static  $_coreClass = array();
	private static $_app;
	
	public $module = '';
	public $controller = '';
	public $action = '';
	
	public static $coreDirs = array(
		'application/components/',
	);
	
	public function __construct() {
		$this->module = getgpc('m');
		$this->controller = getgpc('c');
		$this->action = getgpc('a');
		
		godhouse::$_app = $this;
	}
	
	public static function app() {
		return godhouse::$_app;
	}
	
	/* 引入PHP文件 */
	public static function import() {
		$files = godhouse::$coreDirs;
		foreach($files as $k=>$v) {
			$dirPath = GODHOUSE_ROOT.$v;
			$dirs = opendir($dirPath);
			while(false !== ($file=readdir($dirs))) {
				$file = $dirPath.$file;
				$fileType = filetype($file);
				if($fileType == 'file') {
					require($file);
				}
			}
		}
	}
}
/*
function __autoload($class) {
	
}*/